package com.neu.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.neu.base.BaseEntity;
import com.neu.utils.excel.EasyExcelConvert;
import com.neu.utils.excel.EnumFiledConvert;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;


@Schema(description = "用户实体")
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user")
public class User extends BaseEntity {

    @TableId(type=IdType.ASSIGN_ID)
    @ExcelProperty(value = "用户ID")
    private String userId;
    /**
     * 用户名
     */
    @ExcelProperty("用户名")
    @NotBlank(message = "用户名不能为空")
    private String username;

    /**
     * 密码
     */
    @ExcelIgnore//忽略导出
    @NotBlank(message = "密码不能为空")
    private String password;

    /**
     * 租户ID
     */
    @ExcelIgnore
    private String tenantId;

    /**
     * 默认角色ROLE_user
     */
    @ExcelIgnore
    private String defaultRole;

    /**
     * 用户昵称
     */
    @ExcelProperty("昵称")
    private String nickname;

    /**
     * 用户头像
     */
    @ExcelIgnore//忽略导出
    private String avatar;

    /**
     * 用户性别
     * 1：男  0：女  2：不愿意透露
     */
    @ExcelProperty(value = "性别",converter = EasyExcelConvert.class)
    @EnumFiledConvert(enumMap = "1|男,0|女")
    private String gender;
    /**
     * 用户状态
     * 1：正常  0：禁用
     */
    @ExcelProperty(value = "状态",converter = EasyExcelConvert.class)
    @EnumFiledConvert(enumMap = "1|正常,0|禁用")
    private String status;


    /**
     * 邮箱
     */
    @ExcelProperty("邮箱")
    @Email(message = "邮箱格式不正确")
    private String email;
    /**
     * 手机号码
     */
    @ExcelProperty(value = "手机号")
    private String phone;
    /**
     * 备注
     */
    @ExcelProperty("备注")
    private String remark;


    /**
     * 注册类型
     *  0 管理员新增，1 用户自助注册
     */
    @ExcelIgnore
    private String registerType;

}
